Repository navigation
feat(shot): report the device's locale with --locale - #52
Merged
Merged
Conversation
shot --locale <tag> (and semantics, and shot(locale:)) reports that locale as the device's instead of en-US: a language, then an optional script and region, such as ja-JP or zh-Hant-TW. The shell's app widget resolves its locale from it against its supportedLocales, and so do a preview's localizations that set no locale. The run records it as a language tag, shot prints it, and diff prints both runs' when they differ and returns it as ShotSetup.locale; it is not part of shot ids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
A deprecated language or region (iw, BU) is recorded as dart:ui's Locale replaces it (he, MM), since that is the locale the app gets, so two runs that render alike no longer differ in locale. diff now quotes the locale as shot does, so a YAML 1.1 reader takes Norwegian's `no` for the string, not false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Stacked on #51.
flutter testreports en-US as the device's locale, so an app that resolves its locale from the device (itsMaterialApp,CupertinoApp, orWidgetsAppagainstsupportedLocales) was always shot in English, and a preview'slocalizationswithout alocaleresolved to English too. A screen of a Japanese app attached to a PR was not the screen its users see.How it works
shutter shot --locale <tag>(andsemantics) reports that locale as the device's; from Dart,shot(locale: 'ja-JP'). The tag is a language (two or three letters), then an optional script and region, joined by-or_:ja-JP,ja_jp,zh-Hant-TW.localesTestValueandlocaleTestValueto the locale, so an app widget resolves its locale from it against itssupportedLocales, as does a preview'sLocalizationsResolverwithout alocale. An app widget that does not support the locale falls back as on a device; the default shell'sMaterialAppsupports only en-US.shootrejects anything else with exit 64.localeinmanifest.jsonas a language tag with each code in its usual case (zh-Hant-TW),shotprints it, anddiffprints both runs' when they differ and returns it asShotSetup.locale. It is not part of shot ids.Tests
test/e2e/device_test.dart: under--locale ja-JP,View.of(context).platformDispatcher.localeisja_JP, and a preview whoselocalizationssupportenandjaresolves toja; without it, neither;diffprintslocale.Docs
doc/manual.mdgains a Locale section; runs, output, and commands name the option.doc/agent.md, the README, and the CHANGELOG cover it.🤖 Generated with Claude Code